<?php
/**
 * TestGuest Version1.0
 * ================================================
 * Copy 2017-2018 zxj
 * Web: http://www.zhaoxiaojie.club
 * ================================================
 * Author: Zxj
 * Date: 17/8/11
 * Time: 下午5:58
 *
 * 处理发帖请求!
 *
 */
session_start();
//载入函数库
include 'common/mysql.inc.php';
include 'common/function.inc.php';

$act = $_GET['act']?$_GET['act']:null;



if($act=='add'){

    //验证是否登录,未登录无权发帖
    if(empty($_SESSION['pro_username'])){

        _alert_back('您还未登录,无权发帖哦~');
        //$usename = '匿名用户';

    }else{
        $usename = $_SESSION['pro_username'];
    }

    $fid = _guo_lv($_POST['fid']);
    $title = _guo_lv($_POST['title']);
    $content = _guo_lv($_POST['content']);



    $addtime = date('Y-m-d H:i:s');
    $hits = 100;
    //组装sql语句
    $sql = "insert into bbs_notes VALUES (NULL,$fid,'$title','$content','$usename','$addtime',$hits)";
    //echo $sql;die();
    $res = mysql_query($sql);

    if($res&&mysql_affected_rows()>0){

        echo '<script>alert("发帖成功!");window.location.href="forum.php?id='.$fid.'";</script>';

    }else{

        _alert_back('添加失败!');

    }

}elseif($act=='edit'){



}elseif($act=='del'){



}else{

    _alert_back('参数错误!');


}




?>